package com.wj.console.graphql.controller;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wj.console.graphql.service.GraphSchema;

import graphql.GraphQL;

@Controller
@RequestMapping("/user") 
public class UserController {
	
	@Autowired
	private GraphSchema graphSchemaService;
	
	@RequestMapping("/list")
	@ResponseBody
	public Object getStu(HttpServletRequest request,String query){
		Map<String, Object> result = (Map<String, Object>) new GraphQL(graphSchemaService.getSchema()).execute(query).getData();
		return result;
	}
}
